package org.ekingstar.webService;

import org.ekingstar.qd.domain.QdFormula;
import org.ekingstar.qd.service.CRelationService;

import com.ekingstar.framework.util.ServiceLocator;

/**
 * 表关系业务处理webService
 * @author 
 */
public class CRelationWebService {

	/**
	 * @descripte 增加表关系，成功返回1，失败返回-1 
	 * @param strDomainId 主题ID号
	 * @param strExpr     表关系表达式
	 * @param strDescript 表关系描述
	 * @return int
	 */
	public int addRelation(String strDomainId,String strExpr,String strDescript){
		CRelationService cRelationService = (CRelationService)ServiceLocator.getInstance().getBean("relationService");
		return cRelationService.addRelation(strDomainId, strExpr, strDescript);
	}
	
	
	/**
	 * @descripte 修改表关系，成功返回1，失败返回-1
	 * @param relationId  表关系ID号
	 * @param strDomainId 主题ID号
	 * @param strExpr     表关系表达式
	 * @param strDescript 表关系描述
	 * @return int
	 */
	public int updateRelation(String relationId,String strDomainId,String strExpr,String strDescript){
		CRelationService cRelationService = (CRelationService)ServiceLocator.getInstance().getBean("relationService");
		return cRelationService.updateRelation(relationId, strDomainId, strExpr, strDescript);
	}
	

	/**
	 * @descripte 删除表关系，删除成功返回1，否则返回-1
	 * @param relationId  表关系ID号
	 * @return int
	 */
	public int deleteRelation(String relationId){
		CRelationService cRelationService = (CRelationService)ServiceLocator.getInstance().getBean("relationService");
		return cRelationService.deleteRelation(relationId);
	}
	
	
	/**
	 * @descripte 获取表关系
	 * @param relationId  表关系ID号
	 * @return QdFormula
	 */
	public QdFormula getRelation(String relationId){
		CRelationService cRelationService = (CRelationService)ServiceLocator.getInstance().getBean("relationService");
		return cRelationService.getRelation(relationId);
	}
	
	/**
	 * @descripte 通过主题ID获取表关系
	 * @param strDomainId  主题ID号
	 * @return QdFormula
	 */
	public QdFormula getRelationByDomainId(String strDomainId){
		CRelationService cRelationService = (CRelationService)ServiceLocator.getInstance().getBean("relationService");
		return cRelationService.getRelationByDomainId(strDomainId);
	}
	
}
